#include <rtthread.h>
#include <stdio.h>
#include <string.h>
#include "net_app.h"
#include "BT.h"
#include "global.h"
#include "magnet_dev.h"
#include "Usart_controller.h"
#include "fatfs.h"


rt_event_t general_event = RT_NULL,net_event = RT_NULL;

uint8_t all_event_init(){
		general_event = rt_event_create("general", RT_IPC_FLAG_FIFO);
    if (general_event == RT_NULL){
        rt_kprintf("general event", "event create failed\n");
        return -1;
    }
		net_event = rt_event_create("net_event", RT_IPC_FLAG_FIFO);
    if (net_event == RT_NULL){
        rt_kprintf("net event", "event create failed\n");
        return -1;
    }
}

int val=0;
int main(void){
	
 
	all_event_init();
	Usart_Controller_Init();
//	Blue_Init();
//	blue_config();
	//magnet_Init();
	 MX_FATFS_Init();
	Net_Init();
	while(1){
			SET_OUTPUT(4,1);
			rt_thread_delay(rt_tick_from_millisecond(500));
			SET_OUTPUT(4,0);
			//rt_kprintf("run\n");
	}
	
	return 0;
}
